<?php

namespace  Ekadmin\Controller;

use \Think\Controller;

use Think\Page;



class HexiaoController extends CommonController

{

        public  function index()

        {
             $where['uniacid'] = $this->uniacid;
             $param = I('get.');
             
             if($param["out_trade_no"]){
                 
                 $where['out_trade_no']=$param["out_trade_no"];
                 
             }
             
             $this->uid=$param["uid"];

             if($param["uid"]){
                 
                 $where['uid']=$param["uid"];
             }
             
            $obj = M('hexiao_record');

            $count = $obj->where($where)->count();
            
            $page = new Page($count);
            
            $list = $obj->where($where)->limit($page->firstRow.','.$page->listRows)->order('id')->select();
            
            if($list){
                for($i=0;$i<count($list);$i++){
                    $rs=M("user")->where("uniacid=".$this->uniacid." and id=".$list[$i]["uid"])->find();
                    $list[$i]["acv"]=$rs["head"];
                    $list[$i]["nickname"]=$rs["nickname"];
                    $rs=M("beginer_apply")->where("uid=".$list[$i]["uid"])->find();
                    $list[$i]["mobile"]=$rs["mobile"];
                    $list[$i]["name"]=$rs["name"];
                }
            }

            $this->assign('page',$page->show());
            
            $this->assign('count',$count);

            $this->assign('list',$list);

            $this->display();

        }


        public function del()

        {

            if(IS_POST){

                $param = I('id');

                if(is_array($param)){
                    
                    $map['id'] = array("in",$param);

                }else{

                    $map['id'] = $param;

                }
                
                $map["uniacid"]=$this->uniacid;

                M('hexiao_record')->where($map)->delete();



                ajax_return(0,'删除成功');

            }

        }






}